getBytes("gb2312")是干什么的?
来源:百度知道 编辑:UC知道 时间:2024/05/05 22:51:28
在jsp书中看到以下代码段:
<%!String trans(String chi){
String result=null;
byte temp[];
try{temp=chi.getBytes("gb2312");
result=new String(temp);}
catch(java.io.UnsupportedEncodingException e){
system.out.println(e.toString());
}return result;
}%>
这个方法是实现什么功能的?输入的chi和输出的result字符串有什么不同?
<%!String trans(String chi){
String result=null;
byte temp[];
try{temp=chi.getBytes("gb2312");
result=new String(temp);}
catch(java.io.UnsupportedEncodingException e){
system.out.println(e.toString());
}return result;
}%>
这个方法是实现什么功能的?输入的chi和输出的result字符串有什么不同?
实现字符编码的转换,chi的编码方式我们不知道,所以要正确显示成中文就必须对编码进行转换"gb2312"是中文的一种编码方式。
实现字符编码的转换,防止乱码的
实现转码,如果有中文的话
chi为乱码,result为中文
byte bb[]=s.getBytes("iso-8859-1");是什么意思?
public byte[] getBytes()我想问下这个getBytes()怎么用
Encoding.Default.GetBytes(b(A_1, algorithm));
jsp form 传值 nextpage接收后用getBytes()把GBK转化为UTF-8显示,字数为奇数是最后一个字显示为乱码
""""""!!!!急寻!!!!!"""""""
<魔域>"""""""""""""""""""""
psp 问题"""""""100分""""""""
replace(ffffff,""","")
魔兽世界???????"""""MC""""""
没有一天不做梦的.急"""""""""""""""""""""""""""